package org.omg.CORBA;

import com.cognition.util.marshal.JavaPrimitiveInputStream;
import com.cognition.util.marshal.JavaPrimitiveOutputStream;
import java.io.IOException;

/**
 * The base interface IDLType is inherited by all IR objects that
 * represent OMG IDL types. It provides access to the TypeCode
 * describing the type, and is used in defining other interfaces
 * wherever definitions of IDL types must be referenced.
 */
public class _IDLTypeStub extends org.omg.CORBA.portable.ObjectImpl
        implements IDLType
{
    static final String[] _ids_list =
    {
        "IDL:omg.org/CORBA/IDLType:1.0", 
        "IDL:omg.org/CORBA/IRObject:1.0"
    };

    public String[] _ids()
    {
     return _ids_list;
    }

    private final static Class _opsClass = org.omg.CORBA.IDLTypeOperations.class;

    /**
     * Read accessor for type attribute
     * @return the attribute value
     */
    public org.omg.CORBA.TypeCode type()
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try {
                    org.omg.CORBA.portable.OutputStream _output = this._request("_get_type",true);
                    _input = this._invoke(_output);
                    return _input.read_TypeCode();
                } catch (final org.omg.CORBA.portable.RemarshalException _exception) {
                    continue;
                } catch (final org.omg.CORBA.portable.ApplicationException _exception) {
                    final String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                } finally {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("_get_type",_opsClass);
                if (_so == null)
                   continue;
                org.omg.CORBA.IDLTypeOperations _self = (org.omg.CORBA.IDLTypeOperations) _so.servant;
                try
                {
                    return _self.type();
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Read accessor for def_kind attribute
     * @return the attribute value
     */
    public org.omg.CORBA.DefinitionKind def_kind()
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try {
                    org.omg.CORBA.portable.OutputStream _output = this._request("_get_def_kind",true);
                    _input = this._invoke(_output);
                    return org.omg.CORBA.DefinitionKindHelper.read(_input);
                } catch (final org.omg.CORBA.portable.RemarshalException _exception) {
                    continue;
                } catch (final org.omg.CORBA.portable.ApplicationException _exception) {
                    final String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                } finally {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("_get_def_kind",_opsClass);
                if (_so == null)
                   continue;
                org.omg.CORBA.IRObjectOperations _self = (org.omg.CORBA.IRObjectOperations) _so.servant;
                try
                {
                    return _self.def_kind();
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation destroy
     */
    public void destroy()
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("destroy",true);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("destroy",_opsClass);
                if (_so == null)
                   continue;
                org.omg.CORBA.IRObjectOperations _self = (org.omg.CORBA.IRObjectOperations) _so.servant;
                try
                {
                    _self.destroy();
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }


}
